package br.ufpe.cin.msc.jrsj2.recommender.algorithm.newuser;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import br.ufpe.cin.msc.jrsj2.recommender.persistence.domain.Program;

public class RandomStrategy extends NewUserStrategy {

	@Override
	public List<Program> getItens(List<Program> set, int size) {
		List<Program> itens = new ArrayList<Program>();
		Random random = new Random();
		int i = 0;

		while (i < size && i < set.size()) {
			int index = random.nextInt(size);
			if (index >= size || index >= set.size())
				continue;
			if (itens.contains(set.get(index)))
				continue;
			itens.add(set.get(index));
			i++;
		}

		return itens;
	}

}
